package com.lovo.pis.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lovo.pis.dto.LogBean;
import com.lovo.pis.dto.PageBean;
import com.lovo.pis.dto.UserBean;
import com.lovo.pis.mapper.LogMapper;
import com.lovo.pis.mapper.UserMapper;
import com.lovo.pis.service.ILogService;
import com.lovo.pis.service.IUserService;
import lombok.extern.java.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Objects;

@Service
public class LogServiceImpl extends ServiceImpl<LogMapper, LogBean> implements ILogService {

    @Autowired
    LogMapper logMapper;
    @Autowired
    UserMapper userMapper;

    @Override
    public IPage<LogBean> queryAll(PageBean<LogBean> pageInfo) {
        QueryWrapper queryWrapper = new QueryWrapper();
        if (pageInfo.getStartDate()!=null && pageInfo.getStartDate()!=""){
            queryWrapper.ge("date",pageInfo.getStartDate());
        }
        if (pageInfo.getEndDate()!=null && pageInfo.getEndDate()!=""){
            queryWrapper.le("date",pageInfo.getEndDate());
        }
        return logMapper.selectPage(new Page<>(pageInfo.getCurPage(),pageInfo.getPageSize()),queryWrapper);
    }



}
